﻿Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System
Imports System.Web
Imports System.Configuration
Imports System.Collections

Partial Public Class _Default
    Inherits System.Web.UI.Page

    Dim WHCONN As String = ConfigurationSettings.AppSettings("BRANDON-PC")
    Private Conn As SqlConnection = New SqlConnection(WHCONN)

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


    End Sub

    Private Sub rdoSearchTerms_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoSearchTerms.SelectedIndexChanged

    End Sub

    Private Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click

        'Check that node has a value
        If ddlNode.SelectedValue <> "" Then

            lblNodeError.Visible = False
            'pnlSearchBtns.Visible = False
            lblNodeError.Text = ""

            If rdoSearchTerms.SelectedItem.Text = "Date Range" Then

                'Dim sqlConnTest As New SqlConnection("BRANDON-PC")
                'Dim testStr As String = "SELECT One FROM tblBase"
                'Dim cmdInfo As New SqlClient.SqlCommand(testStr, sqlConnTest)
                'Dim dataTbl As New DataTable()
                'dataTbl.Fill(cmdInfo)

                'sqlConnTest.Close()


                'Dim wdtConn As New SqlConnection
                'wdtConn.ConnectionString = "Data Source=BRANDON-PC;User Id=BRANDON-PC\Brandon;Initial Catalog=WDT;Trusted_Connection=True;"
                'Dim wdtTest As New SqlConnection(wdtConn.ConnectionString)
                'Dim wdtTestString As String = "SELECT One FROM tblBase"
                'Dim wdtAdapter As New SqlDataAdapter(wdtTestString, wdtTest)
                'Dim wdtTable As New DataTable()
                ''Dim wdtStr As String()
                ''wdtStr = CType(wdtAdapter, Integer)
                'Dim wdtDataSet As New DataSet()
                'wdtTest.Close()
                'wdtAdapter.Fill(wdtTable)
                'If wdtTable.Rows.Count = 0 Then
                '    TextBox1.Text = "No Results"
                'Else
                '    TextBox1.Text = "Results = " & Trim(wdtTable.Rows(1).Item("One"))   ' returns value from Row 1 for column name One
                'End If
                'GridView1.DataSource = wdtTable
                'GridView1.Visible = True

                'wdtTest.Close()

                pnlPast.Visible = False
                pnlDR.Visible = True
                pnlGrid.Visible = True

            ElseIf rdoSearchTerms.SelectedItem.Text = "Past" Then

                pnlPast.Visible = True
                pnlDR.Visible = False
                pnlGrid.Visible = True

            End If

        Else
            lblNodeError.Visible = True
            lblNodeError.Text = "* Please select the node you would like to query"
        End If


    End Sub
End Class